package com.sino.second.struts2;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IBasicInfoService;
import com.sino.business.IPatentManageService;
import com.sino.business.IStaticDataService;
import com.sino.model.BasicInfoModel;
import com.sino.second.bean.TblEmailset;
import com.sino.second.bean.TblExpertmessage;
import com.sino.second.bean.TblMessage;
import com.sino.second.business.ISmsService;
import com.sino.util.page.PagerModel;

public class SmsendAction extends ActionSupport {
	private ISmsService smsServiceImpl;

	private IStaticDataService staticDateService;// 基础数据

	private IBasicInfoService basicInfoService;// 基本信息

	private IPatentManageService ipatentManageService;// 项目管理

	private TblEmailset emailSet; // 邮件设置

	private Integer emailSetId; // 邮件ID

	private String year;// 年度;

	private PagerModel pm;//

	private List xkList = null;// ===学科||专业

	private List<BasicInfoModel> bimList = null;

	private String xkId;// 学科||专业ID

	private String sms[];

	private List<TblMessage> xmSmsList;// 项目信息

	private List<TblExpertmessage> emSmsList = null;// 专家信息

	private String emailsString;

	private String message;

	private String zlid;

	private int FBh;

	private String sendTime;

	private String username;

	private String name;

	private String context;

	private String state;

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

	public String getSendTime() {
		return sendTime;
	}

	public void setSendTime(String sendTime) {
		this.sendTime = sendTime;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	// xyw给专家发信息
	public String saveExpertsSms() {
		this.getSmsServiceImpl().saveExpertsSms(emSmsList, sms, message);
		return this.SUCCESS;
	}

	// xyw给项目发信息
	public String saveXmSms() {
		this.getSmsServiceImpl().saveXmSms(xmSmsList, sms, message);
		return this.SUCCESS;
	}

	// xyw查看短信发送状态
	public String listSmsExpertByFBh() {

		TblExpertmessage m = new TblExpertmessage();
		if (null != this.getSmsServiceImpl().findExpertsSmsListByFBh(FBh, "")
				&& this.getSmsServiceImpl().findExpertsSmsListByFBh(FBh, "")
						.size() > 0) {
			m = (TblExpertmessage) this.getSmsServiceImpl()
					.findExpertsSmsListByFBh(FBh, "").get(0);
			sendTime = m.getSenddate().toString();
			username = m.getUsername();
			context = m.getContent();
			state = m.getIssend();
			year = m.getYear();
			return this.SUCCESS;
		} else {
			return this.INPUT;
		}

	}

	// xyw 根据zid查找短信信息
	public String listSmsXmByZlid() {
		TblMessage n = new TblMessage();
		if (null != this.getSmsServiceImpl().findXmSmsListByXmId(zlid, "")
				&& this.getSmsServiceImpl().findXmSmsListByXmId(zlid, "")
						.size() > 0) {
			n = (TblMessage) this.getSmsServiceImpl().findXmSmsListByXmId(zlid,
					"").get(0);
			sendTime = n.getSenddate().toString();
			name = n.getUsername();
			context = n.getContent();
			state = n.getIssend();
			year = n.getYear();
			return this.SUCCESS;
		} else {
			return this.INPUT;
		}

	}

	public IBasicInfoService getBasicInfoService() {
		return basicInfoService;
	}

	public void setBasicInfoService(IBasicInfoService basicInfoService) {
		this.basicInfoService = basicInfoService;
	}

	public List<BasicInfoModel> getBimList() {
		return bimList;
	}

	public void setBimList(List<BasicInfoModel> bimList) {
		this.bimList = bimList;
	}

	public TblEmailset getEmailSet() {
		return emailSet;
	}

	public int getFBh() {
		return FBh;
	}

	public void setFBh(int bh) {
		FBh = bh;
	}

	public String getZlid() {
		return zlid;
	}

	public void setZlid(String zlid) {
		this.zlid = zlid;
	}

	public void setEmailSet(TblEmailset emailSet) {
		this.emailSet = emailSet;
	}

	public Integer getEmailSetId() {
		return emailSetId;
	}

	public void setEmailSetId(Integer emailSetId) {
		this.emailSetId = emailSetId;
	}

	public String getEmailsString() {
		return emailsString;
	}

	public void setEmailsString(String emailsString) {
		this.emailsString = emailsString;
	}

	public IPatentManageService getIpatentManageService() {
		return ipatentManageService;
	}

	public void setIpatentManageService(
			IPatentManageService ipatentManageService) {
		this.ipatentManageService = ipatentManageService;
	}

	public PagerModel getPm() {
		return pm;
	}

	public void setPm(PagerModel pm) {
		this.pm = pm;
	}

	public ISmsService getSmsServiceImpl() {
		return smsServiceImpl;
	}

	public void setSmsServiceImpl(ISmsService smsServiceImpl) {
		this.smsServiceImpl = smsServiceImpl;
	}

	public IStaticDataService getStaticDateService() {
		return staticDateService;
	}

	public void setStaticDateService(IStaticDataService staticDateService) {
		this.staticDateService = staticDateService;
	}

	public String getXkId() {
		return xkId;
	}

	public void setXkId(String xkId) {
		this.xkId = xkId;
	}

	public List getXkList() {
		return xkList;
	}

	public void setXkList(List xkList) {
		this.xkList = xkList;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String[] getSms() {
		return sms;
	}

	public void setSms(String[] sms) {
		this.sms = sms;
	}

	public List<TblExpertmessage> getEmSmsList() {
		return emSmsList;
	}

	public void setEmSmsList(List<TblExpertmessage> emSmsList) {
		this.emSmsList = emSmsList;
	}

	public List<TblMessage> getXmSmsList() {
		return xmSmsList;
	}

	public void setXmSmsList(List<TblMessage> xmSmsList) {
		this.xmSmsList = xmSmsList;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
